<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>let 命令</title>
 <script>
// 计算传入数据的平均值
function avg(...values) {
let sum = 0;
for (var val of values) {
sum += val;
}
return sum / values.length;
}
 let result = avg(1, 2, 3)
 console.log(result); // 2
 </script>
 </head>
 <body></body>
 </html>